package com.bwf.pojo;

import com.bwf.exception.DepositException;

/**
 * @version v1.0
 * @description:
 * @author: admin
 * @date: 2022/12/19 13:56
 * @copyright: 博为峰
 */
public class SavingAccount extends Account {
    /*public SavingAccount() {
    }*/

    public SavingAccount(String cardNo, String passwd, double balance) {
        super(cardNo, passwd, balance);
    }

    @Override
    public void deposit(double money) {
        double balance = getBalance();
        if (money > balance) {
            throw new DepositException("余额不足");
        } else {
            balance = balance - money;
            setBalance(balance);
        }
    }
}
